#include <stdio.h>
#include <stdlib.h>
#include "list.h"

void print_s(const void *ptr)
{
     const int *num = ptr;
     printf("%d     ", *num);
}
int main(int argc, const char *argv[])
{
     head *handler;
     handler = list_create(sizeof(int));
     if (handler == NULL)
          exit(1);
     for (int i = 0; i < 10; i++)
     {
          //int ret = list_insert(handler, &i,INSERT_FORWORD);  //前插法建立
          int ret = list_insert(handler, &i, INSERT_END); //后插法建立
          if (ret)
               exit(1);
     }
     list_show(handler, print_s);
     list_destory(&handler);
     printf("%d", *((int *)handler->first.data));
     //list_show(handler, print_s);
     return 0;
}
